package org.dromara.common.core.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class OrderUtil {

    /**
     * 产生订单号
     * @return
     */
    public static String getOrderNoByTime(){
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        int random = (int)(Math.random() * 9000 + 1000);
        String order_no = sdf.format(date) + random;
        return order_no;
    }

    /**
     * 产生订单号
     * @return
     */
    public static String getOrderNoByTimespan(){
        Date date = new Date();
        String order_no = "1000" + date.getTime();
        return order_no;
    }

    /**
     * 产生拼团 团编号
     * @return
     */
    public static String getGroupNo(){
        Date date = new Date();
        String order_no = "80" + date.getTime();
        return order_no;
    }

    /**
     * 产生商家爱活动编号
     * @return
     */
    public static String getActiveNo(){
        Date date = new Date();
        String order_no = "20" + date.getTime();
        return order_no;
    }

}
